# encoding=utf8

import sys
reload(sys)
sys.setdefaultencoding('utf8')
from ..MessageAnalysis import*

class JT_0001:
    result = []
    str=""
    analysisDescription = ['应答流水号:', '应答ID:', '结果:']
    #字段长度，以字节为单位
    analysis0001Length=[2,2,1]

    def LogicAisle(self, protocolStr, header):
        print "header0001=%s"%header[1].split(':')[1]
        count = 0
        for i in range(len(self.analysisDescription)):
			if i==2:
				str=protocolStr[count:count + (self.analysis0001Length[i] * 2)]
				if str=="00":
					header.append(self.analysisDescription[2] + str +" (成功/确认)"+ "\n")
				elif str=="01":
					header.append(self.analysisDescription[2] + str + " (失败）" + "\n")
				elif str=="02":
					header.append(self.analysisDescription[2] + str + " (消息有误)" + "\n")
				elif str=="03":
					header.append(self.analysisDescription[2] + str + " （不支持）" + "\n")
				elif str=="04":
					header.append(self.analysisDescription[2] + str + " (报警处理确认)" + "\n")
				count = count + self.analysis0001Length[i] * 2
			else:
				header.append(self.analysisDescription[i] + protocolStr[count:count + (self.analysis0001Length[i] * 2)] + "\n");
				count = count + self.analysis0001Length[i] * 2

        self.result = header


